#import "ALApp.h"

@implementation ALApp

// TODO: NOT TRACKING RELEASE DATE OF VERSION
+(NSSet *)keyPathsForValuesAffectingLatestVersion {
	return [NSSet setWithObject:@"versions"];
}

-(ALVersion *)latestVersion {
	NSSet *versions = [self versions];
	NSArray *sortDescriptors = [NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:ALReleaseDateKey ascending:YES]];
	NSArray *sortedVersions = [versions sortedArrayUsingDescriptors:sortDescriptors];
	return [sortedVersions lastObject];
}

@end
